package com.ihr360.entity;

import java.io.Serializable;
import java.util.List;

/**
 * @author Stone.Shi
 * @description
 * @date 2018-01-25 16:59:30.
 */
public class PageData<T> implements Serializable {

    private static final long serialVersionUID = -8576289719406945518L;

    private long totalPages;
    private long totalElements;
    private List<T> content;

    private boolean end;

    public PageData() {
    }

    public PageData(long totalPages, long totalElements, List<T> content) {
        this.content = content;
        this.totalPages = totalPages;
        this.totalElements = totalElements;
    }

    public PageData(long totalPages, long totalElements, List<T> content, boolean end) {
        this.content = content;
        this.totalPages = totalPages;
        this.totalElements = totalElements;
        this.end = end;
    }

    public boolean isEnd() {
        return end;
    }

    public long getTotalPages() {
        if (0 == totalPages) {
            return 1;
        }
        return totalPages;
    }

    public long getTotalElements() {
        return totalElements;
    }

    public List<T> getContent() {
        return content;
    }
}
